<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>汉文化活动 - 汉中旅游</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/wenhua.css">
</head>
<body>
    <!-- 页面加载动画 -->
    <div class="page-loader">
        <div class="loader"></div>
    </div>

    <!-- 用户小部件 -->
    <div class="user-widget">
        <a href="login.html" id="login-link" class="btn btn-login">登录/注册</a>
        <div id="user-profile" style="display: none;">
            <img src="img/attractions/touxiang.jpg" alt="User Avatar" class="avatar">
            <span id="username-display"></span>
            <a href="#" id="logout-link" title="退出登录"><i class="fas fa-sign-out-alt"></i></a>
        </div>
    </div>

    <!-- 浮动导航菜单 -->
    <div class="float-nav">
        <button class="float-nav-toggle" id="floatNavToggle" title="快速导航">
            <i class="fas fa-bars"></i>
        </button>
        <div class="float-nav-menu" id="floatNavMenu">
            <ul>
                <li><a href="index.html">首页</a></li>
                <li><a href="jingdian.html">景点介绍</a></li>
                <li><a href="luxian.html">旅游线路</a></li>
                <li><a href="gonglue.html">旅游攻略</a></li>
                <li><a href="meishi.html">美食推荐</a></li>
                <li><a href="wenhua.html" class="active">汉文化活动</a></li>
                <li><a href="contact.html">联系我们</a></li>
                <li><a href="faq.html">常见问题</a></li>
            </ul>
        </div>
    </div>

    <!-- 导航栏 -->
    <nav>
        <div class="container">
            <div class="nav-container">
                <div class="nav-logo">
                    <a href="index.html">
                        <img src="img/attractions/logo.jpg" alt="汉中旅游" class="nav-logo-img">
                        <h2>汉中旅游</h2>
                    </a>
                </div>
                <ul class="main-nav">
                    <li><a href="index.html">首页</a></li>
                    <li><a href="jingdian.html">景点介绍</a></li>
                    <li><a href="luxian.html">旅游线路</a></li>
                    <li><a href="gonglue.html">旅游攻略</a></li>
                    <li><a href="meishi.html">美食推荐</a></li>
                    <li><a href="wenhua.html" class="active">汉文化活动</a></li>
                    <li><a href="contact.html">联系我们</a></li>
                    <li><a href="faq.html">常见问题</a></li>
                </ul>
                <!-- 用户操作区域已被移到独立的 user-widget 中 -->
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <main>
        <!-- 页面标题 -->
        <section class="page-header">
            <div class="container">
                <h1>汉中汉文化活动</h1>
                <p>探索千年古城的文化魅力</p>
            </div>
        </section>

        <!-- 文化导航 -->
        <section class="culture-nav">
            <div class="container">
                <div class="nav-grid">
                    <div class="nav-item">
                        <i class="fas fa-calendar-alt"></i>
                        <h3>传统节庆</h3>
                        <p>体验汉中特色节日文化</p>
                    </div>
                    <div class="nav-item">
                        <i class="fas fa-theater-masks"></i>
                        <h3>非遗展示</h3>
                        <p>感受非物质文化遗产魅力</p>
                    </div>
                    <div class="nav-item">
                        <i class="fas fa-hands"></i>
                        <h3>文化体验</h3>
                        <p>参与互动文化体验活动</p>
                    </div>
                    <div class="nav-item">
                        <i class="fas fa-landmark"></i>
                        <h3>历史遗迹</h3>
                        <p>探索汉中历史文化底蕴</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 主要内容区域 -->
        <section class="main-content">
            <div class="container">
                <!-- 主要文化活动展示 -->
                <h2 class="section-title">特色文化活动</h2>
                <div class="culture-grid" id="culture-grid-container">
                    <!-- 特色文化活动将由JS动态加载 -->
                    <p>正在加载文化活动...</p>
                </div>

                <!-- 其他文化活动 -->
                <div class="culture-details">
                    <h3>其他特色文化活动</h3>
                    <div class="activity-list">
                        <div class="activity-item">
                            <h5>汉中皮影戏展演</h5>
                            <p>汉中皮影戏是省级非物质文化遗产，具有鲜明的地方特色。定期举办的展演活动，让游客欣赏到这一独特的传统艺术形式。</p>
                        </div>
                        <div class="activity-item">
                            <h5>汉中剪纸艺术展</h5>
                            <p>汉中剪纸艺术以其精湛的技艺和独特的风格闻名。艺术展展示了传统剪纸作品，并举办互动体验活动。</p>
                        </div>
                        <div class="activity-item">
                            <h5>汉中茶文化节</h5>
                            <p>汉中是中国著名的茶叶产区，茶文化节展示汉中仙毫等特色茶叶，举办茶艺表演和品茶活动。</p>
                        </div>
                        <div class="activity-item">
                            <h5>汉中傩舞表演</h5>
                            <p>汉中傩舞是古老的祭祀舞蹈，具有浓厚的宗教色彩。表演活动让游客了解这一独特的民间艺术。</p>
                        </div>
                        <div class="activity-item">
                            <h5>汉中漆艺展示</h5>
                            <p>汉中漆艺历史悠久，制作精美。展示活动让游客了解传统漆艺的制作工艺和艺术价值。</p>
                        </div>
                        <div class="activity-item">
                            <h5>汉中民俗文化展</h5>
                            <p>展示汉中地区的传统民俗文化，包括民间艺术、传统习俗、节庆活动等内容。</p>
                        </div>
                    </div>
                </div>
                
                <!-- 汉中文化活动日历表格 -->
                <section class="culture-calendar">
                    <h2 class="section-title">汉中文化活动日历</h2>
                    <p class="calendar-intro">以下是汉中全年重要文化活动安排，方便您提前规划行程，不错过精彩活动。</p>
                    
                    <div class="table-container">
                        <table class="culture-table">
                            <thead>
                                <tr>
                                    <th>时间</th>
                                    <th>活动名称</th>
                                    <th>地点</th>
                                    <th>活动特色</th>
                                    <th>参与方式</th>
                                </tr>
                            </thead>
                            <tbody id="culture-calendar-body">
                                <!-- 日历内容将由JS动态加载 -->
                                <tr>
                                    <td colspan="5" style="text-align:center;">正在加载活动日历...</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    
                    <div class="table-note">
                        <p><i class="fas fa-info-circle"></i> 注：活动时间可能会有所调整，请在出行前关注官方公告或咨询当地旅游部门。</p>
                    </div>
                </section>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3>关于我们</h3>
                    <p>汉中旅游网致力于为游客提供最全面的汉中旅游信息，让您的汉中之行更加便捷、愉快。</p>
                    <div class="social-links">
                        <a href="#"><i class="fab fa-weibo"></i></a>
                        <a href="#"><i class="fab fa-weixin"></i></a>
                        <a href="#"><i class="fab fa-qq"></i></a>
                    </div>
                </div>
                <div class="footer-section">
                    <h3>快速链接</h3>
                    <ul>
                        <li><a href="index.html">首页</a></li>
                        <li><a href="jingdian.html">景点介绍</a></li>
                        <li><a href="luxian.html">旅游线路</a></li>
                        <li><a href="gonglue.html">旅游攻略</a></li>
                        <li><a href="contact.html">联系我们</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>热门景点</h3>
                    <ul>
                        <li><a href="jingdian.html#wuhoumu">武侯墓</a></li>
                        <li><a href="jingdian.html#nanhu">南湖</a></li>
                        <li><a href="jingdian.html#dingjunshan">定军山</a></li>
                        <li><a href="jingdian.html#guchengqiang">古城墙</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>联系方式</h3>
                    <p><i class="fas fa-map-marker-alt"></i> 地址：陕西省汉中市</p>
                    <p><i class="fas fa-phone"></i> 电话：0916-123456</p>
                    <p><i class="fas fa-envelope"></i> 邮箱：info@hanzhong-tourism.com</p>
                </div>
            </div>
        </div>
        <div class="footer-bottom">
            <div class="container">
                <p>&copy; 2023 汉中旅游网 版权所有</p>
            </div>
        </div>
    </footer>

    <script src="js/api.js"></script>
    <script src="js/main.js"></script>
    <script src="js/script.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', async () => {
            const activities = await TravelAPI.getAllCulturalActivitiesV1();
            if (activities && activities.length > 0) {
                renderActivityCards(activities);
                renderActivityCalendar(activities);
            } else {
                document.getElementById('culture-grid-container').innerHTML = '<p>暂无特色文化活动。</p>';
                document.getElementById('culture-calendar-body').innerHTML = '<tr><td colspan="5" style="text-align:center;">暂无活动日历。</td></tr>';
            }
        });

        function renderActivityCards(activities) {
            const container = document.getElementById('culture-grid-container');
            if (!container) return;

            // 我们只在卡片区显示前4个最主要的活动
            const featuredActivities = activities.slice(0, 4);

            const cardsHtml = featuredActivities.map(activity => {
                const detailsHtml = activity.details.map(detail => `
                    <div class="detail-section">
                        <h4>${detail.subtitle}</h4>
                        <p>${detail.content}</p>
                    </div>
                `).join('');

                return `
                    <div class="culture-card">
                        <div class="card-image">
                            <img src="${activity.image}" alt="${activity.title}">
                        </div>
                        <div class="card-content">
                            <h3>${activity.title}</h3>
                            <p>${activity.mainDescription}</p>
                            <div class="culture-details">
                                ${detailsHtml}
                            </div>
                        </div>
                    </div>
                `;
            }).join('');

            container.innerHTML = cardsHtml;
        }

        function renderActivityCalendar(activities) {
            const tbody = document.getElementById('culture-calendar-body');
            if (!tbody) return;

            // 为了日历的完整性，我们这里显示所有活动
            const calendarHtml = activities.map(activity => {
                // 将所有小卡片的副标题和内容合并，作为"活动特色"
                const features = activity.details.map(d => d.content).join(' ');
                return `
                    <tr>
                        <td>${activity.displayDate}</td>
                        <td>${activity.title}</td>
                        <td>${activity.location}</td>
                        <td>${features}</td>
                        <td>${activity.participationMethod}</td>
                    </tr>
                `;
            }).join('');

            tbody.innerHTML = calendarHtml;
        }
    </script>
    <style>
        /* 汉文化活动页面特定样式 */
        
        /* 文化活动日历表格样式 */
        .culture-calendar {
            margin: 60px 0;
            padding: 20px 0;
        }
        
        .calendar-intro {
            text-align: center;
            margin-bottom: 30px;
            font-size: 1.1em;
            color: #555;
        }
        
        .table-container {
            overflow-x: auto;
            box-shadow: 0 5px 15px rgba(0,0,0,0.08);
            border-radius: 10px;
            background: #fff;
        }
        
        .culture-table {
            width: 100%;
            border-collapse: collapse;
            border-spacing: 0;
            background: #fff;
            overflow: hidden;
        }
        
        .culture-table thead {
            background-color: #DC4E42;
            color: white;
        }
        
        .culture-table th {
            padding: 18px 15px;
            text-align: left;
            font-weight: 600;
            font-size: 1.1em;
            text-transform: uppercase;
        }
        
        .culture-table td {
            padding: 15px;
            border-bottom: 1px solid #f2f2f2;
            vertical-align: middle;
        }
        
        .culture-table tbody tr:hover {
            background-color: rgba(220, 78, 66, 0.05);
        }
        
        .culture-table tbody tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        
        .culture-table tbody tr:last-child td {
            border-bottom: none;
        }
        
        .table-note {
            margin-top: 20px;
            font-style: italic;
            color: #666;
            text-align: center;
        }
        
        .table-note i {
            color: #DC4E42;
            margin-right: 5px;
        }
        
        @media (max-width: 768px) {
            .culture-table th, 
            .culture-table td {
                padding: 12px 10px;
                font-size: 0.9em;
            }
        }
    </style>
</body>
</html> 